package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionDailyItemDAO;
import com.cssy.xxkj.logic.entity.LogicProductionDailyItemDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-30
 */
public class LogicProductionDailyItemDAOImpl extends SqlMapClientDaoSupport implements LogicProductionDailyItemDAO {

    /**
     * 插入数据
     * @param logicProductionDailyItemDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionDailyItemDO(LogicProductionDailyItemDO logicProductionDailyItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionDailyItem.insert", logicProductionDailyItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionDailyItemDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionDailyItemDOByExample(LogicProductionDailyItemDO logicProductionDailyItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDailyItem.countByDOExample", logicProductionDailyItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionDailyItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionDailyItemDO(LogicProductionDailyItemDO logicProductionDailyItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionDailyItem.update", logicProductionDailyItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionDailyItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionDailyItemDO> findListByExample(LogicProductionDailyItemDO logicProductionDailyItemDO) throws DataAccessException {
        List<LogicProductionDailyItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDailyItem.findListByDO", logicProductionDailyItemDO);
        return list;
    }

    /**
     * 根据主键获取logicProductionDailyItemDO
     * @param id
     * @return logicProductionDailyItemDO
     */
    public LogicProductionDailyItemDO findLogicProductionDailyItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionDailyItemDO logicProductionDailyItemDO = (LogicProductionDailyItemDO) getSqlMapClientTemplate().queryForObject("LogicProductionDailyItem.findByPrimaryKey", id);
        return logicProductionDailyItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionDailyItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionDailyItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionDailyItemDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionDailyItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDailyItem_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDailyItem_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer delProDailyId(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionDailyItem_ex.delProDailyId", id);
        return rows;
	}

}